﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jumpton.SFA.Server.Entity;
using Jumpton.SFA.Server.BusinessRule;
using Jumpton.Persistent;

public partial class CallRoute_ReadPhoto : PageBase
{
    private const string REQUEST_PHOTO_ID = "id";
    private decimal id=0;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString[REQUEST_PHOTO_ID] != null)
        {
            PhotoManager pm=new PhotoManager();
            Jumpton.SFA.Entity.PHOTO p=pm.Load(Request.QueryString[REQUEST_PHOTO_ID]);
            if(p!=null)
            {
                oImg.Src = "../Photo.aspx?" + p.ID;
            }

            DataSet ds = PhotoManager.GetPhotoList(MyStateManager.DomainID," AND P.ID='"+p.ID+"'");//usp_SelectCUSTOMER_PHOTO->DictionaryItems 对应的项和CUSTOMER_PHOTO中找到的不一样
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRowView drv = ds.Tables[0].DefaultView[0];
                lblCustomer.Text = drv["NAME"].ToString();
                lblDate.Text = BusinessLogic.GetDateTime(drv["START_TIME"].ToString(),"yyyyMMddHHmmss","yyyy-MM-dd HH:mm:ss");
                lblType.Text = drv["PHOTO_TYPE_ID"].ToString();
                ObjectTable ot= new DictionaryItemsManager().GetItemList(DictionaryEnum.PhotoType, this.MyStateManager.DomainID);
                foreach (DictionaryItems di in ot)
                {
                    if (di.DictionaryItemID.ToString() == lblType.Text)
                    {
                        lblType.Text = di.Name;
                        break;
                    }
                }
                //lblUserCode.Text = drv["user_code"].ToString();
                //lblUserName.Text = drv["user_name"].ToString();
                //lblMemo.Text = drv["PHOTO_MEMO"].ToString();
                //lblOrgName.Text = drv["ORG_NAME"].ToString();

                //if (drv["PHOTO_TYPE_ID"].ToString() == "2" || drv["PHOTO_TYPE_ID"].ToString() == "131")
                //{
                //    oImg_customer.Visible = true;
                //    tdCustomer.Visible = true;
                //    lblCustomer_Photo.Text = "门店照片";
                //    oImg_customer.Src = "../masterdata/Customer_Store_Photo.aspx?customerId=" + drv["CUSTOMER_ID"].ToString() + "&pageIndex=1";
                //}


            }
        }
    }

  
}
